#include <iostream>
#include <vector>
#include <string>

using namespace std;
#include"vector.h"

void test_vector1()
{
	ly::vector<int> v;

	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);

	ly::vector<int>::iterator it = v.begin();
	while (it != v.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	ly::vector<int> v1(10, 1);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;

	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	v1.pop_back();
	for (auto e : v1)
	{
		cout << e << " ";
	}
}

void test_vector2()
{
	ly::vector<int> v;

	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;

	ly::vector<int> v1(v.begin(), v.end());
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;
	cout << v1.capacity() << endl;
	cout << v1.size() << endl;
}

void test_vector3()
{
	ly::vector<int> v;

	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;
	cout << v.capacity() << endl;
	cout << v.size() << endl;

	ly::vector<int> v1(v);
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;
	cout << v1.capacity() << endl;
	cout << v1.size() << endl;
}

void test_vector4()
{
	ly::vector<int> v;

	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;

	ly::vector<int> v1;
	v1.push_back(10);
	v1.push_back(20);
	v1.push_back(30);
	v1.push_back(40);
	v1.push_back(50);
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;

	v1 = v;
	for (auto c : v)
	{
		cout << c << " ";
	}
	cout << endl;
}

int main()
{
	test_vector4();

	return 0;
}


//int main()
//{
//	vector<int> v(10, 2);
//	cout << v.size() << endl;
//	cout << v.capacity() << endl;
//
//	v.reserve(5);
//	cout << v.capacity() << endl;
//
//	return 0;
//}


//void test1()
//{
//	vector<int> v;
//
//	v.push_back(1);
//	v.push_back(2);
//	v.push_back(3);
//	v.push_back(4);
//	v.push_back(5);
//	v.push_back(6);
//
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//	v.pop_back();
//
//}
//
//void test()
//{
//	vector<int> v;
//	v.push_back(1);
//	v.push_back(2);
//	v.push_back(3);
//	v.push_back(4);
//	v.push_back(5);
//	v.push_back(6);
//
//	vector<int> v1(v.begin(), v.begin());
//	for (auto e : v1)
//	{
//		cout << e << " ";
//	}
//	cout << endl;
//	cout << v1.size() << endl;
//	cout << v1.capacity() << endl;
//}
//
//int main()
//{
//	test();
//
//	return 0;
//}